\(\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx\) [252]
Optimal result
Integrand size = 29, antiderivative size = 89 \[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {(A b-a B) x}{b^2}-\frac {2 a (A b-a B) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^2 \sqrt {a+b} d}+\frac {B \sin (c+d x)}{b d}
\]
[Out]
(A*b-B*a)*x/b^2+B*sin(d*x+c)/b/d-2*a*(A*b-B*a)*arctan((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b)^(1/2))/b^2/d/(a-b)^
(1/2)/(a+b)^(1/2)
Rubi [A] (verified)
Time = 0.20 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.00, number of
steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {3047, 3102, 12, 2814, 2738,
211} \[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=-\frac {2 a (A b-a B) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^2 d \sqrt {a-b} \sqrt {a+b}}+\frac {x (A b-a B)}{b^2}+\frac {B \sin (c+d x)}{b d}
\]
[In]
Int[(Cos[c + d*x]*(A + B*Cos[c + d*x]))/(a + b*Cos[c + d*x]),x]
[Out]
((A*b - a*B)*x)/b^2 - (2*a*(A*b - a*B)*ArcTan[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(Sqrt[a - b]*b^2*Sq
rt[a + b]*d) + (B*Sin[c + d*x])/(b*d)
Rule 12
Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] && !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]
Rule 211
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]
Rule 2738
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[2*(e/d), Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]
Rule 2814
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]
Rule 3047
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Int[(a + b*Sin[e + f*x])^m*(A*c + (B*c + A*d)*Sin[e + f*x] + B*d*Sin[e + f*x
]^2), x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0]
Rule 3102
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Dist[1/(
b*(m + 2)), Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x],
x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && !LtQ[m, -1]
Rubi steps \begin{align*}
\text {integral}& = \int \frac {A \cos (c+d x)+B \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx \\ & = \frac {B \sin (c+d x)}{b d}+\frac {\int \frac {(A b-a B) \cos (c+d x)}{a+b \cos (c+d x)} \, dx}{b} \\ & = \frac {B \sin (c+d x)}{b d}+\frac {(A b-a B) \int \frac {\cos (c+d x)}{a+b \cos (c+d x)} \, dx}{b} \\ & = \frac {(A b-a B) x}{b^2}+\frac {B \sin (c+d x)}{b d}-\frac {(a (A b-a B)) \int \frac {1}{a+b \cos (c+d x)} \, dx}{b^2} \\ & = \frac {(A b-a B) x}{b^2}+\frac {B \sin (c+d x)}{b d}-\frac {(2 a (A b-a B)) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^2 d} \\ & = \frac {(A b-a B) x}{b^2}-\frac {2 a (A b-a B) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^2 \sqrt {a+b} d}+\frac {B \sin (c+d x)}{b d} \\
\end{align*}
Mathematica [A] (verified)
Time = 0.47 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.96
\[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {(A b-a B) (c+d x)-\frac {2 a (-A b+a B) \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+b B \sin (c+d x)}{b^2 d}
\]
[In]
Integrate[(Cos[c + d*x]*(A + B*Cos[c + d*x]))/(a + b*Cos[c + d*x]),x]
[Out]
((A*b - a*B)*(c + d*x) - (2*a*(-(A*b) + a*B)*ArcTanh[((a - b)*Tan[(c + d*x)/2])/Sqrt[-a^2 + b^2]])/Sqrt[-a^2 +
b^2] + b*B*Sin[c + d*x])/(b^2*d)
Maple [A] (verified)
Time = 0.95 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.24
| | |
method | result | size |
| | |
derivativedivides |
\(\frac {\frac {\frac {2 B b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \left (A b -B a \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{2}}-\frac {2 a \left (A b -B a \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}}{d}\) |
\(110\) |
default |
\(\frac {\frac {\frac {2 B b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \left (A b -B a \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{2}}-\frac {2 a \left (A b -B a \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}}{d}\) |
\(110\) |
risch |
\(\frac {x A}{b}-\frac {a B x}{b^{2}}-\frac {i {\mathrm e}^{i \left (d x +c \right )} B}{2 b d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B}{2 b d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A}{\sqrt {-a^{2}+b^{2}}\, d b}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, d \,b^{2}}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A}{\sqrt {-a^{2}+b^{2}}\, d b}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, d \,b^{2}}\) |
\(352\) |
| | |
|
|
|
[In]
int(cos(d*x+c)*(A+B*cos(d*x+c))/(a+cos(d*x+c)*b),x,method=_RETURNVERBOSE)
[Out]
1/d*(2/b^2*(B*b*tan(1/2*d*x+1/2*c)/(1+tan(1/2*d*x+1/2*c)^2)+(A*b-B*a)*arctan(tan(1/2*d*x+1/2*c)))-2*a*(A*b-B*a
)/b^2/((a-b)*(a+b))^(1/2)*arctan((a-b)*tan(1/2*d*x+1/2*c)/((a-b)*(a+b))^(1/2)))
Fricas [A] (verification not implemented)
none
Time = 0.31 (sec) , antiderivative size = 322, normalized size of antiderivative = 3.62
\[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\left [-\frac {2 \, {\left (B a^{3} - A a^{2} b - B a b^{2} + A b^{3}\right )} d x - {\left (B a^{2} - A a b\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - 2 \, {\left (B a^{2} b - B b^{3}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{2} b^{2} - b^{4}\right )} d}, -\frac {{\left (B a^{3} - A a^{2} b - B a b^{2} + A b^{3}\right )} d x - {\left (B a^{2} - A a b\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (B a^{2} b - B b^{3}\right )} \sin \left (d x + c\right )}{{\left (a^{2} b^{2} - b^{4}\right )} d}\right ]
\]
[In]
integrate(cos(d*x+c)*(A+B*cos(d*x+c))/(a+b*cos(d*x+c)),x, algorithm="fricas")
[Out]
[-1/2*(2*(B*a^3 - A*a^2*b - B*a*b^2 + A*b^3)*d*x - (B*a^2 - A*a*b)*sqrt(-a^2 + b^2)*log((2*a*b*cos(d*x + c) +
(2*a^2 - b^2)*cos(d*x + c)^2 - 2*sqrt(-a^2 + b^2)*(a*cos(d*x + c) + b)*sin(d*x + c) - a^2 + 2*b^2)/(b^2*cos(d*
x + c)^2 + 2*a*b*cos(d*x + c) + a^2)) - 2*(B*a^2*b - B*b^3)*sin(d*x + c))/((a^2*b^2 - b^4)*d), -((B*a^3 - A*a^
2*b - B*a*b^2 + A*b^3)*d*x - (B*a^2 - A*a*b)*sqrt(a^2 - b^2)*arctan(-(a*cos(d*x + c) + b)/(sqrt(a^2 - b^2)*sin
(d*x + c))) - (B*a^2*b - B*b^3)*sin(d*x + c))/((a^2*b^2 - b^4)*d)]
Sympy [B] (verification not implemented)
Leaf count of result is larger than twice the leaf count of optimal. 3225 vs. \(2 (76) = 152\).
Time = 56.39 (sec) , antiderivative size = 3225, normalized size of antiderivative = 36.24
\[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\text {Too large to display}
\]
[In]
integrate(cos(d*x+c)*(A+B*cos(d*x+c))/(a+b*cos(d*x+c)),x)
[Out]
Piecewise((zoo*x*(A + B*cos(c)), Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (A*d*x*tan(c/2 + d*x/2)**2/(b*d*tan(c/2 + d*
x/2)**2 + b*d) + A*d*x/(b*d*tan(c/2 + d*x/2)**2 + b*d) - A*tan(c/2 + d*x/2)**3/(b*d*tan(c/2 + d*x/2)**2 + b*d)
- A*tan(c/2 + d*x/2)/(b*d*tan(c/2 + d*x/2)**2 + b*d) - B*d*x*tan(c/2 + d*x/2)**2/(b*d*tan(c/2 + d*x/2)**2 + b
*d) - B*d*x/(b*d*tan(c/2 + d*x/2)**2 + b*d) + B*tan(c/2 + d*x/2)**3/(b*d*tan(c/2 + d*x/2)**2 + b*d) + 3*B*tan(
c/2 + d*x/2)/(b*d*tan(c/2 + d*x/2)**2 + b*d), Eq(a, b)), (A*d*x*tan(c/2 + d*x/2)**3/(b*d*tan(c/2 + d*x/2)**3 +
b*d*tan(c/2 + d*x/2)) + A*d*x*tan(c/2 + d*x/2)/(b*d*tan(c/2 + d*x/2)**3 + b*d*tan(c/2 + d*x/2)) + A*tan(c/2 +
d*x/2)**2/(b*d*tan(c/2 + d*x/2)**3 + b*d*tan(c/2 + d*x/2)) + A/(b*d*tan(c/2 + d*x/2)**3 + b*d*tan(c/2 + d*x/2
)) + B*d*x*tan(c/2 + d*x/2)**3/(b*d*tan(c/2 + d*x/2)**3 + b*d*tan(c/2 + d*x/2)) + B*d*x*tan(c/2 + d*x/2)/(b*d*
tan(c/2 + d*x/2)**3 + b*d*tan(c/2 + d*x/2)) + 3*B*tan(c/2 + d*x/2)**2/(b*d*tan(c/2 + d*x/2)**3 + b*d*tan(c/2 +
d*x/2)) + B/(b*d*tan(c/2 + d*x/2)**3 + b*d*tan(c/2 + d*x/2)), Eq(a, -b)), ((A*sin(c + d*x)/d + B*x*sin(c + d*
x)**2/2 + B*x*cos(c + d*x)**2/2 + B*sin(c + d*x)*cos(c + d*x)/(2*d))/a, Eq(b, 0)), (x*(A + B*cos(c))*cos(c)/(a
+ b*cos(c)), Eq(d, 0)), (A*a*b*d*x*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2/(a*b**2*d*sqrt(-a/(a - b)
- b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b)
)*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) + A*a*b*d*x*sqrt(-a/(a - b) - b/(a - b))/(a*b**2*
d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a
- b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) - A*a*b*log(-sqrt(-a/(a - b) - b
/(a - b)) + tan(c/2 + d*x/2))*tan(c/2 + d*x/2)**2/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 +
a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt
(-a/(a - b) - b/(a - b))) - A*a*b*log(-sqrt(-a/(a - b) - b/(a - b)) + tan(c/2 + d*x/2))/(a*b**2*d*sqrt(-a/(a -
b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a -
b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) + A*a*b*log(sqrt(-a/(a - b) - b/(a - b)) + tan
(c/2 + d*x/2))*tan(c/2 + d*x/2)**2/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(
-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b
/(a - b))) + A*a*b*log(sqrt(-a/(a - b) - b/(a - b)) + tan(c/2 + d*x/2))/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))
*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d
*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) - A*b**2*d*x*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2/
(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sq
rt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) - A*b**2*d*x*sqrt(-a/(a
- b) - b/(a - b))/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a
- b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) - B*a*
*2*d*x*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2
)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*
d*sqrt(-a/(a - b) - b/(a - b))) - B*a**2*d*x*sqrt(-a/(a - b) - b/(a - b))/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b
))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 +
d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) + B*a**2*log(-sqrt(-a/(a - b) - b/(a - b)) + tan(c/2 + d*x/2
))*tan(c/2 + d*x/2)**2/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) -
b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) +
B*a**2*log(-sqrt(-a/(a - b) - b/(a - b)) + tan(c/2 + d*x/2))/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 +
d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 -
b**3*d*sqrt(-a/(a - b) - b/(a - b))) - B*a**2*log(sqrt(-a/(a - b) - b/(a - b)) + tan(c/2 + d*x/2))*tan(c/2 +
d*x/2)**2/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) -
b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) - B*a**2*log(s
qrt(-a/(a - b) - b/(a - b)) + tan(c/2 + d*x/2))/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a
*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-
a/(a - b) - b/(a - b))) + B*a*b*d*x*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2/(a*b**2*d*sqrt(-a/(a - b)
- b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b)
)*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) + B*a*b*d*x*sqrt(-a/(a - b) - b/(a - b))/(a*b**2*
d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a
- b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b))) + 2*B*a*b*sqrt(-a/(a - b) - b/(a
- b))*tan(c/2 + d*x/2)/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 + a*b**2*d*sqrt(-a/(a - b)
- b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3*d*sqrt(-a/(a - b) - b/(a - b)))
- 2*B*b**2*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)/(a*b**2*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/
2)**2 + a*b**2*d*sqrt(-a/(a - b) - b/(a - b)) - b**3*d*sqrt(-a/(a - b) - b/(a - b))*tan(c/2 + d*x/2)**2 - b**3
*d*sqrt(-a/(a - b) - b/(a - b))), True))
Maxima [F(-2)]
Exception generated. \[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\text {Exception raised: ValueError}
\]
[In]
integrate(cos(d*x+c)*(A+B*cos(d*x+c))/(a+b*cos(d*x+c)),x, algorithm="maxima")
[Out]
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
for more de
Giac [A] (verification not implemented)
none
Time = 0.30 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.60
\[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=-\frac {\frac {{\left (B a - A b\right )} {\left (d x + c\right )}}{b^{2}} - \frac {2 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} b} + \frac {2 \, {\left (B a^{2} - A a b\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2}} b^{2}}}{d}
\]
[In]
integrate(cos(d*x+c)*(A+B*cos(d*x+c))/(a+b*cos(d*x+c)),x, algorithm="giac")
[Out]
-((B*a - A*b)*(d*x + c)/b^2 - 2*B*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x + 1/2*c)^2 + 1)*b) + 2*(B*a^2 - A*a*b)*(p
i*floor(1/2*(d*x + c)/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sq
rt(a^2 - b^2)))/(sqrt(a^2 - b^2)*b^2))/d
Mupad [B] (verification not implemented)
Time = 1.23 (sec) , antiderivative size = 541, normalized size of antiderivative = 6.08
\[
\int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {2\,B\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^2-b^2\right )}-\frac {2\,A\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^2-b^2\right )}-\frac {B\,b\,\sin \left (c+d\,x\right )}{d\,\left (a^2-b^2\right )}+\frac {2\,A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d\,\left (a^2-b^2\right )}-\frac {2\,B\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b^2\,d\,\left (a^2-b^2\right )}+\frac {A\,a\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d\,\sqrt {b^2-a^2}}-\frac {A\,a\,\ln \left (\frac {b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d\,\sqrt {b^2-a^2}}-\frac {B\,a^2\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b^2\,d\,\sqrt {b^2-a^2}}+\frac {B\,a^2\,\ln \left (\frac {b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b^2\,d\,\sqrt {b^2-a^2}}+\frac {B\,a^2\,\sin \left (c+d\,x\right )}{b\,d\,\left (a^2-b^2\right )}
\]
[In]
int((cos(c + d*x)*(A + B*cos(c + d*x)))/(a + b*cos(c + d*x)),x)
[Out]
(2*B*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^2 - b^2)) - (2*A*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 +
(d*x)/2)))/(d*(a^2 - b^2)) - (B*b*sin(c + d*x))/(d*(a^2 - b^2)) + (2*A*a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 +
(d*x)/2)))/(b*d*(a^2 - b^2)) - (2*B*a^3*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(b^2*d*(a^2 - b^2)) + (A*
a*log((a*sin(c/2 + (d*x)/2) - b*sin(c/2 + (d*x)/2) + cos(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/cos(c/2 + (d*x)/2))
)/(b*d*(b^2 - a^2)^(1/2)) - (A*a*log((b*sin(c/2 + (d*x)/2) - a*sin(c/2 + (d*x)/2) + cos(c/2 + (d*x)/2)*(b^2 -
a^2)^(1/2))/cos(c/2 + (d*x)/2)))/(b*d*(b^2 - a^2)^(1/2)) - (B*a^2*log((a*sin(c/2 + (d*x)/2) - b*sin(c/2 + (d*x
)/2) + cos(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/cos(c/2 + (d*x)/2)))/(b^2*d*(b^2 - a^2)^(1/2)) + (B*a^2*log((b*si
n(c/2 + (d*x)/2) - a*sin(c/2 + (d*x)/2) + cos(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/cos(c/2 + (d*x)/2)))/(b^2*d*(b
^2 - a^2)^(1/2)) + (B*a^2*sin(c + d*x))/(b*d*(a^2 - b^2))